package com.xpqh.ksg.common.persistence.dao;

import com.xpqh.ksg.common.persistence.model.KsgSeriesDetails;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xpqh.ksg.modular.core.dto.KsgPriceListRespDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2025-04-18
 */
public interface KsgSeriesDetailsMapper extends BaseMapper<KsgSeriesDetails> {
    
    @Select("select  (select introduce from ksg_product_info where id = #{productId}) introduce,price,yqg_price yqgPrice,qbxg_price qbxgPrice,hbxg_price hbxgPrice,dm_price dmPrice,qyzb_price qyzbPrice,hyzb_price hyzbPrice,whsj_price whsjPrice,cq_price cqPrice,hgb_price hgbPrice,cd_price cdPrice from ksg_series_details where series_id = #{carSeriesId} and product_series_id = #{productId} and status = 0")
    KsgPriceListRespDTO getPriceInfo(@Param("carSeriesId") String carSeriesId, @Param("productId") String productId);
    
    @Select("select  IFNULL(default_price,0) price,introduce,default_price * 0.14 yqgPrice,default_price * 0.2 qbxgPrice,default_price * 0.2 hbxgPrice,default_price * 0.05 dmPrice,default_price * 0.04 qyzbPrice,default_price * 0.25 hyzbPrice,default_price * 0.01 whsjPrice,0 cqPrice,default_price * 0.07 hgbPrice,default_price * 0.04 cdPrice from ksg_product_info where  id = #{productId}")
    KsgPriceListRespDTO getPriceInfoByType( @Param("productId") String productId);

    @Select("select  (select introduce from ksg_product_info where id = #{productId}) introduce,price,yqg_price yqgPrice,qbxg_price qbxgPrice,hbxg_price hbxgPrice,dm_price dmPrice,qyzb_price qyzbPrice,hyzb_price hyzbPrice,whsj_price whsjPrice,cq_price cqPrice,hgb_price hgbPrice,cd_price cdPrice FROM ksg_product_quote a WHERE a.product_id = #{productId} AND a.car_lv = #{carLv} AND a.price_lv = #{priceLv}")
    KsgPriceListRespDTO getCyPriceInfo(@Param("productId") int productId, @Param("carLv") String carLv, @Param("priceLv") int priceLv);


}

